package com.example.junior.activities;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;

import basicas.AoMudarFavoritoListener;
import basicas.Time;
import fragments.DetalheTimeFragment;

/**
 * Created by Junior on 28/10/2014.
 */
public class DetalheTimeActivity extends ActionBarActivity implements AoMudarFavoritoListener{

    public static final String EXTRA_TIME = "time";


    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_time_detalhe);

        Time time = (Time)getIntent().getSerializableExtra(EXTRA_TIME);

        DetalheTimeFragment detalheTimeFragment =
                DetalheTimeFragment.newInstance(time);

        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.replace(R.id.container,detalheTimeFragment,"detalhe");
        transaction.commit();
    }

    @Override
    public void aoMudarFavorito(Time time, boolean favorito) {
        setResult(RESULT_OK);
    }

}
